/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dominio;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author jair
 */
@Entity
@Table(name = "Aluno")
public class Aluno implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Column(name = "RGALUNO")
    private Integer rgaluno;
    
    @Size(max = 100)
    @Column(name = "Nome_aluno")
    private String nomealuno;
    
   @OneToMany(mappedBy = "aluno", fetch = FetchType.LAZY)
    private Set<Matricula> matricula = new HashSet<>();

    public Aluno() {
    }

    public Integer getRgaluno() {
        return rgaluno;
    }

    public void setRgaluno(Integer rgaluno) {
        this.rgaluno = rgaluno;
    }

    public String getNomealuno() {
        return nomealuno;
    }

    public void setNomealuno(String nomealuno) {
        this.nomealuno = nomealuno;
    }

    public Set<Matricula> getMatricula() {
        return matricula;
    }

    public void setMatricula(Set<Matricula> matricula) {
        this.matricula = matricula;
    }

   
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rgaluno != null ? rgaluno.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aluno)) {
            return false;
        }
        Aluno other = (Aluno) object;
        if ((this.rgaluno == null && other.rgaluno != null) || (this.rgaluno != null && !this.rgaluno.equals(other.rgaluno))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dominio.Aluno[ rgaluno=" + rgaluno + " ]";
    }
    
}
